package com.gientech.loancenter.controller;

import com.gientech.loancenter.entity.LoanApply;
import com.gientech.loancenter.service.LoanApplyService;
import com.gientech.loancommon.vo.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class LoanApplyController {

    @Autowired
    private LoanApplyService loanApplyService;

    /**
     * 贷款申请
     * @param loanApply
     * @return
     */
    @PostMapping("/loanApply")
    public ResponseResult loanApply(@RequestBody LoanApply loanApply){
        return loanApplyService.loanApply(loanApply);
    }

    /**
     * 分页查询贷款审批列表
     * @return
     */
    @GetMapping("/pageLoanApply")
    public ResponseResult pageLoanApply(){
        return loanApplyService.pageLoanApply();
    }

    /**
     * 贷款审批
     * @param id
     * @param status
     * @return
     */
    @GetMapping("/doCheck")
    public ResponseResult doCheck(@RequestParam Long id,@RequestParam Integer status) {
        return loanApplyService.doCheck(id,status);
    }

    /**
     * 分页查询贷款审批列表
     * @return
     */
    @GetMapping("/pageLoanByStatus")
    public ResponseResult pageLoanByStatus(@RequestParam Integer status){
        return loanApplyService.pageLoanByStatus(status);
    }

    /**
     * 放款审批
     * @param id
     * @param releaseAmount
     * @return
     */
    @GetMapping("/doRelease")
    public ResponseResult doRelease(@RequestParam Long id,@RequestParam Float releaseAmount) {
        return loanApplyService.doRelease(id,releaseAmount);
    }

}
